/*
 * @Author: szx
 * @Date: 2022-02-27 13:48:46
 * @LastEditTime: 2022-02-27 14:13:22
 * @Description:
 * @FilePath: \leetcode\1400-1499\1470\1470.js
 */
/**
 * @param {number[]} nums
 * @param {number} n
 * @return {number[]}
 */
var shuffle = function (nums, n) {
    const arr = Array.from(nums);
    let a = 0;
    let x = 0;
    let y = n;
    while (a < nums.length) {
        nums[a++] = arr[x++];
        nums[a++] = arr[y++];
    }
    return nums;
};

var shuffle = function (nums, n) {
    let a = 0;
    let x = 0;
    let y = n;
    while (a < nums.length) {
        nums[a++] |= (nums[x++] & 0x3ff) << 10;
        nums[a++] |= nums[y++] << 10;
    }
    for (let i = 0; i < nums.length; i++) nums[i] = nums[i] >> 10;
    return nums;
};
